package com.xiashitech.agent.proxy.hutool;

import com.xiashitech.agent.cache.classloader.ClassLoaderCache;
import com.xiashitech.agent.config.StartConfig;

import java.nio.charset.Charset;

public class ResourceUtil {
    private static String className = "cn.hutool.core.io.resource.ResourceUtil";

    public static String readStr(String src, Charset charset) {
        try {
            Class strUtilClass = ClassLoaderCache.getLaunchClassLoader().loadClass(className);
            return (String)strUtilClass.getMethod("readStr", String.class, Charset.class).invoke(null,src, charset);
        } catch (Throwable e) {
            StartConfig.throwableStackPrinter(e);
        }
        return "";//和hutool语义保持一致
    }
}
